﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Catalina.Common;

namespace Catalina.MVP
{
	public partial class CatalinaPrintView : Form
	{
		public CatalinaPrintView()
		{
			InitializeComponent();
		}

		internal void UpdateHeaders(BindingList<CatalinaHeader> catalinaHeaders)
		{
			BindDataSource(dgvHeaders, catalinaHeaders);
		}

		private void BindDataSource(DataGridView view, BindingList<CatalinaHeader> table)
		{
			BindingSource source = new BindingSource();
			source.DataSource = table;
			view.DataSource = source;
		}

		private void printButton_Click(object sender, EventArgs e)
		{
			OnTimeToPrint();
		}

		protected void OnTimeToPrint()
		{
			if (TimeToPrint != null)
				TimeToPrint(dgvHeaders.SelectedRows);
		}

		public event CatalinaPrintEventHandler TimeToPrint;
		public delegate void CatalinaPrintEventHandler(DataGridViewSelectedRowCollection batch);
	}
}
